How to change the Graph Type at Runtime using VBA in MS access


Here's the given an article will guide you to know that "How to change the Graph type at run time" using VBA code in MS Access. This article explains through an example here:-

Firstly create a Table in the Database which contain 2 fields show below in fig :- 1.1.

How to change the Graph type at run time using VBA-Fig:-1.1

Fig:-1.1

Create a form with Graph and Radio Group. When the user click on the radio button then change the type of Graph. Eg:- If you click on column radio button then show the Graph in column. Show in fig:- 1.2.

How to change the Graph type at run time using VBA-Fig:-1.2

Fig:-1.2

If you click on the "line" radio button then Graph change in line format. Like this you change the Graph type like Column , Line , Pie , Area , Doughnut , Bar , Radar , Scatter. As shown in Fig:- 1.3.

How to change the Graph type at run time using VBA-Fig:-1.3

Fig:-1.3

Set the option value of radio button

Steps for set the option value of radio button

  1. Select the radio button
  2. Right click on selected radio button and click on properties option
  3. After open the properties window go to Data -> Option value
Option values
Column 51
Line 4
Pie 5
Area 1
Doughnut 80
Bar 60
Radar 82
Radar 72

------------------- Code for On After Update event of the "optionGroupChart" -------------------

Option Compare Database
Private Sub optionGroupChart_AfterUpdate()
[Graph0] .Object.Application.Chart.ChartType = optionGroupChart
End Sub


DISCLAIMER

It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. ERP Makers will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.


 

BUY SERVICES CONTACT